﻿using BLL;
using models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace yuejilalala
{
    public partial class AddproductType : System.Web.UI.Page
    {
        ProductCountMarager Marager = new ProductCountMarager();//商品组合类型Marager
        ProductTypeMarager Marager2 = new ProductTypeMarager();//商品类型Marager
        ProductType productType = null;
        protected void Page_Load(object sender, EventArgs e)
        {
            //显示商品组合类型
            DropDownList1.DataSource = Marager.SumProductCount();
            DropDownList1.DataTextField = "ProcountName";
            DropDownList1.DataValueField = "Id";
            DropDownList1.DataBind();
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            //新增商品类型
            productType = new ProductType();
            productType.TypeName = tb_lx.Text;
            productType.Typecount =int.Parse( DropDownList1.SelectedValue);
            if (Marager2.AddProductType(productType))
            {
                Response.Write("<script>alert('新增商品成功')</script>");
            }
        }
    }
}